`
https://leetcode.cn/problems/symmetric-tree/
`

/**
 * Definition for a binary tree node.
 * function TreeNode(val, left, right) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.left = (left===undefined ? null : left)
 *     this.right = (right===undefined ? null : right)
 * }
 */
/**
 * @param {TreeNode} root
 * @return {boolean}
 */
var isSymmetric = function (root) {
  return _isSymmetric(root.left, root.right)
};

function _isSymmetric(p, q) {
  if (p == null && q == null) {
    return true;
  }
  if (p == null || q == null) {
    return false;
  }
  if (p.val != q.val) {
    return false;
  }
  // 判断其他节点是否对称
  return _isSymmetric(p.left, q.right) && _isSymmetric(p.right, q.left)
}